<%@page pageEncoding="UTF-8" language="java" %>
<!--_meta 作为公共模版分离出去-->
<%@ include file="/commons/global.jsp"%>
<!DOCTYPE HTML>
<html>
<head>
    <meta charset="utf-8">
    <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
    <meta http-equiv="Cache-Control" content="no-siteapp" />
    <link rel="Bookmark" href="favicon.ico" >
    <link rel="Shortcut Icon" href="favicon.ico" />
    <script type="text/javascript" src="<%=request.getContextPath()%>/static/lib/html5.js"></script>
    <script type="text/javascript" src="<%=request.getContextPath()%>/static/lib/respond.min.js"></script>
    <![endif]-->
    <link rel="stylesheet" type="text/css" href="<%=request.getContextPath()%>/static/h-ui/css/H-ui.min.css" />
    <link rel="stylesheet" type="text/css" href="<%=request.getContextPath()%>/static/h-ui.admin/css/H-ui.admin.css" />
    <link rel="stylesheet" type="text/css" href="<%=request.getContextPath()%>/static/lib/Hui-iconfont/1.0.8/iconfont.css" />
    <link rel="stylesheet" type="text/css" href="<%=request.getContextPath()%>/static/h-ui.admin/skin/default/skin.css" id="skin" />
    <link rel="stylesheet" type="text/css" href="<%=request.getContextPath()%>/static/h-ui.admin/css/style.css" />
    <link rel="stylesheet" type="text/css" href="<%=request.getContextPath()%>/static/css/page.css">
    <!--[if IE 6]>
    <script type="text/javascript" src="http://lib.h-ui.net/DD_belatedPNG_0.0.8a-min.js" ></script>
    <script>DD_belatedPNG.fix('*');</script>
    <![endif]-->
    <!--_menu 作为公共模版分离出去-->
</head>
<body>
<%--<section class="Hui-article-box">--%>
<nav class="breadcrumb"><i class="Hui-iconfont">&#xe67f;</i> 首页
    <span class="c-gray en">&gt;</span>
    超级管理员管理
    <span class="c-gray en">&gt;</span>
    超级管理员列表 <a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新" ><i class="Hui-iconfont">&#xe68f;</i></a> </nav>
<div class="Hui-article">
    <article class="cl pd-20">
        <%--<div class="text-c">--%>
            <%--<form action="<%=request.getContextPath() %>/manage/user/manager"  method="GET" id="pageForm">--%>
                <%--<input type="text" class="input-text" style="width:250px" placeholder="输入管理员名称" id="name" name="name" value="${userVo.name}">--%>
                <%--<input name="type" value="0" hidden>--%>
                <%--<button type="submit" class="btn btn-success" id="" name=""><i class="Hui-iconfont">&#xe665;</i> 搜用户</button>--%>
            <%--</form>--%>
        <%--</div>--%>
        <%--<div class="cl pd-5 bg-1 bk-gray mt-20">--%>
            <%--<span class="l">--%>
                <%--<a href="javascript:void(0);" id="delete" class="btn btn-danger radius"><i class="Hui-iconfont">&#xe6e2;</i> 批量删除</a>--%>
                <%--<a href="javascript:;" id="add" class="btn btn-primary radius"><i class="Hui-iconfont">&#xe600;</i> 添加管理员</a> </span>--%>
            <%--<span class="r">共有数据：<strong>${totalCount}</strong> 条</span>--%>
        <%--</div>--%>
        <div class="mt-20">
        <table class="table table-border table-bordered table-bg">
            <thead>
            <tr>
                <th scope="col" colspan="9">员工列表</th>
            </tr>
            <tr class="text-c">
                <th width="25"><input type="checkbox" name="" value=""></th>
                <th width="40">姓名</th>
                <th width="150">编号</th>
                <th width="150">密码</th>
                <th width="100">操作</th>
            </tr>
            </thead>
            <tbody>
                <c:forEach items="${page}" var="user">
                    <tr class="text-c">
                        <td><input type="checkbox" value="${user.id}" name="" class="ids"></td>
                        <td>${user.name}</td>
                        <td>${user.code}</td>
                        <td>${user.password}</td>
                        <td class="td-manage">
                            <%--<a title="编辑" href="javascript:;" onclick="userUpdate('修改管理员','<%=request.getContextPath()%>/manage/user/userUpdateUI',${user.id})" class="ml-5" style="text-decoration:none"><i class="Hui-iconfont">&#xe6df;</i></a>--%>
                            <%--<a title="删除" href="javascript:;" onclick="userDelete(${user.id})" class="ml-5" style="text-decoration:none"><i class="Hui-iconfont">&#xe6e2;</i></a></td>--%>
                            <a title="修改密码" href="javascript:;" onclick="updatePassword('修改密码','<%=request.getContextPath()%>/manage/user/updatePasswordUI',${user.id})" class="ml-5" style="text-decoration:none"><i class="Hui-iconfont">&#xe6df;</i></a>
                        </td>
                    </tr>
                </c:forEach>
            </tbody>
        </table>
        <jsp:include page="/commons/page.jsp" />
    </article>
</div>
<%--</section>--%>

<!--_footer 作为公共模版分离出去-->
<!--_footer 作为公共模版分离出去-->
<script type="text/javascript" src="<%=request.getContextPath()%>/static/lib/jquery/1.9.1/jquery.min.js"></script>
<script type="text/javascript" src="<%=request.getContextPath()%>/static/lib/layer/2.4/layer.js"></script>
<script type="text/javascript" src="<%=request.getContextPath()%>/static/h-ui/js/H-ui.js"></script>
<script type="text/javascript" src="<%=request.getContextPath()%>/static/h-ui.admin/js/H-ui.admin.page.js"></script>
<!--/_footer /作为公共模版分离出去-->

<!--请在下方写此页面业务相关的脚本-->
<script type="text/javascript" src="<%=request.getContextPath()%>/static/lib/My97DatePicker/4.8/WdatePicker.js"></script>
<script type="text/javascript" src="<%=request.getContextPath()%>/static/lib/datatables/1.10.0/jquery.dataTables.min.js"></script>
<script type="text/javascript" src="<%=request.getContextPath()%>/static/lib/laypage/1.2/laypage.js"></script>
<script type="text/javascript">

    $("#add").click(function(){
        index = layer.open({
            type: 2,
            title:"添加管理员",
            content: "<%=request.getContextPath()%>/manage/user/addUI?type=0"
        });
        layer.full(index);
    });

    function userDelete(id) {
        top.layer.confirm('您确认删除该条记录吗?',
            {
                icon : 3,
                title : '提示'
            },
            function() {
                $.ajax({
                    url: "<%=request.getContextPath()%>/manage/user/userDelete",
                    type: "post",
                    data: {"id": id},
                    dataType: "json",
                    success : function(data){
                        if(data.success){
                            top.layer.closeAll();
                            location.href="<%=request.getContextPath()%>/manage/user/manager?type=0";
                        }else{
                            top.layer.open(
                                {
                                    title: '删除',
                                    content: "删除失败！有关联信息！",
                                    icon:2
                                },function(index){
                                    top.layer.close(index);
                                });
                        }
                    }
                });
            });
    }

    /*批量删除  */
    $("#delete").click(function() {
        var idChecks = $(".ids:checked");
        if (idChecks.length == 0) {
            top.layer.alert("请选择需要删除的记录！");
            return false;
        }
        top.layer.confirm(
            '您确认删除选中的记录吗?',
            {
                icon : 3,
                title : '提示'
            },
            function() {

                var id = "";
                var ids = new Array();
                for (var i = 0; i < idChecks.length; i++) {
                    id += idChecks[i].value
                        + ",";
                    ids[i] = idChecks[i].value;
                }
                $.ajax({
                    url: "<%=request.getContextPath()%>/manage/user/userDeleteIDs",
                    type: "post",
                    data: "ids="+ids,
                    dataType: "json",
                    success: function(data){
                        if(data.success){
                            top.layer.closeAll();
                            location.href="<%=request.getContextPath()%>/manage/user/manager?type=0";
                        }else{
                            top.layer.open(
                                {
                                    title: '删除',
                                    content: "删除失败！有关联信息！",
                                    icon:2
                                },function(index){
                                    top.layer.close(index);
                                });
                        }
                    }
                });
            });
    });

    function userUpdate(title, url, id){
        index = layer.open({
            type: 2,
            title: title,
            content: url + "?type=0&id=" + id
        });
        layer.full(index);
    }

    function updatePassword(title, url, id){
        index = layer.open({
            type: 2,
            title: title,
            content: url + "?id=" + id
        });
        layer.full(index);
    }
    
</script>
</body>
</html>